

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
    <meta name="description" content="若发现文章有误，敬请指教，望不吝赐教，谢谢！@[TOC]  相关资料 zk官方API zk入门指南  一、概述 Zookeeper 可以看成为 Zoo （动物园 ）和 Keeper （管理员）的组合，组合直译就是动物园管理员，那么它能管理的动物有哪些呢? 可以看看百度百科的描述：  ZooKeeper是一个分布式的，开放源码的分布式应用程序协调服务，是Google的Chubby一个开源的实现，是">
<meta property="og:type" content="article">
<meta property="og:title" content="Zookeeper 笔记1 单节点配置">
<meta property="og:url" content="http://example.com/2022/03/07/Zookeeper%20%E7%AC%94%E8%AE%B01%20%20%E5%8D%95%E8%8A%82%E7%82%B9%E9%85%8D%E7%BD%AE/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="若发现文章有误，敬请指教，望不吝赐教，谢谢！@[TOC]  相关资料 zk官方API zk入门指南  一、概述 Zookeeper 可以看成为 Zoo （动物园 ）和 Keeper （管理员）的组合，组合直译就是动物园管理员，那么它能管理的动物有哪些呢? 可以看看百度百科的描述：  ZooKeeper是一个分布式的，开放源码的分布式应用程序协调服务，是Google的Chubby一个开源的实现，是">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/0e6a14432d2c4d4fbfbcd7080f29a146.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/c12c4df6b5b64f48aa6834f58e6f1d73.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/1975cc1cc8c44d55b919c8b3e5e4b20a.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/ea52d69f3e7949ed8add0bc213f8a41e.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/3618b106f40c4dabbb8eb10131f38c00.png">
<meta property="article:published_time" content="2022-03-07T10:13:39.000Z">
<meta property="article:modified_time" content="2022-08-22T15:51:13.699Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="Zookeeper">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/0e6a14432d2c4d4fbfbcd7080f29a146.png">
  
  
  
  <title>Zookeeper 笔记1 单节点配置 - Hexo</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.2","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.2.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>尤 Ni&#39;s Blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Zookeeper 笔记1 单节点配置"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        John Doe
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2022-03-07 18:13" pubdate>
          2022年3月7日 晚上
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          1.4k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          12 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Zookeeper 笔记1 单节点配置</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：1 小时前
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <blockquote>
<p>若发现文章有误，敬请指教，望不吝赐教，谢谢！<br>@[TOC]</p>
</blockquote>
<h1 id="相关资料"><a href="#相关资料" class="headerlink" title="相关资料"></a>相关资料</h1><ul>
<li><a target="_blank" rel="noopener" href="https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index.html">zk官方API</a></li>
<li><a target="_blank" rel="noopener" href="https://zookeeper.apache.org/doc/current/zookeeperStarted.html">zk入门指南</a></li>
</ul>
<h1 id="一、概述"><a href="#一、概述" class="headerlink" title="一、概述"></a>一、概述</h1><hr>
<p>Zookeeper 可以看成为 Zoo （动物园 ）和 Keeper （管理员）的组合，组合直译就是动物园管理员，那么它能管理的动物有哪些呢? 可以看看百度百科的描述：</p>
<blockquote>
<p>ZooKeeper是一个分布式的，开放源码的分布式应用程序协调服务，是Google的Chubby一个开源的实现，是Hadoop和Hbase的重要组件。它是一个为分布式应用提供一致性服务的软件，提供的功能包括：配置维护、域名服务、分布式同步、组服务等。<br>ZooKeeper的目标就是封装好复杂易出错的关键服务，将简单易用的接口和性能高效、功能稳定的系统提供给用户。<br>ZooKeeper包含一个简单的原语集，提供Java和C的接口。<br>ZooKeeper代码版本中，提供了分布式独享锁、选举、队列的接口，代码在$zookeeper_home\src\recipes。其中分布锁和队列有Java和C两个版本，选举只有Java版本。</p>
</blockquote>
<p>内容比较多，可概括为，zk是为分布式应用提供一致性服务的<code>软件</code>，它的其他作用有：</p>
<ul>
<li>配置维护</li>
<li>域名服务</li>
<li>分布式同步</li>
<li>组服务</li>
</ul>
<h2 id="1-1-Zookeeper-运行流程"><a href="#1-1-Zookeeper-运行流程" class="headerlink" title="1.1 Zookeeper 运行流程"></a>1.1 Zookeeper 运行流程</h2><p>zk是以Fast Paxos算法为基础的，通过选取产生一个leader（领导者），只有leader才能提交proposer。</p>
<p>zk的基本运行流程：</p>
<ol>
<li>选举 Leader</li>
<li>同步数据</li>
<li>选举Leader过程中有很多算法，但要达到的选举标准是一致的</li>
<li>Leader要有最高的执行ID，类似 root 权限</li>
<li>集群中大多数的机器得到响应并接受选出的 Leader</li>
</ol>
<h1 id="二、在CentOS7系统下进行zk安装与单节点配置"><a href="#二、在CentOS7系统下进行zk安装与单节点配置" class="headerlink" title="二、在CentOS7系统下进行zk安装与单节点配置"></a>二、在CentOS7系统下进行zk安装与单节点配置</h1><hr>
<h2 id="2-1-运行环境"><a href="#2-1-运行环境" class="headerlink" title="2.1 运行环境"></a>2.1 运行环境</h2><ul>
<li>本机 Windows10</li>
<li>CentOS7 云服务器（以下内容中将其简称为服务器）</li>
<li>JDK8</li>
<li>zookeeper 3.6.3</li>
</ul>
<p><a target="_blank" rel="noopener" href="https://zookeeper.apache.org/releases.html">zk官网</a><br><a target="_blank" rel="noopener" href="https://zookeeper.apache.org/doc/current/zookeeperStarted.html">zk官方入门指南</a></p>
<h2 id="2-2-下载zk"><a href="#2-2-下载zk" class="headerlink" title="2.2 下载zk"></a>2.2 下载zk</h2><p>根据实际情况进行下载，这里笔者下载了版本3.6.3进行测试</p>
<p><img src="https://img-blog.csdnimg.cn/0e6a14432d2c4d4fbfbcd7080f29a146.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>下载后通过XShell传输到虚拟机&#x2F;云服务器，解压压缩包</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">tar -xvf 压缩包.jar -C 压缩保存位置<br></code></pre></td></tr></table></figure>
<h2 id="2-3-配置-zk"><a href="#2-3-配置-zk" class="headerlink" title="2.3 配置 zk"></a>2.3 配置 zk</h2><p>zk的根目录如下图所示：（按国际惯例，配置文件通常在conf内）<br><img src="https://img-blog.csdnimg.cn/c12c4df6b5b64f48aa6834f58e6f1d73.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>zk根目录里的conf文件夹内容：<br><img src="https://img-blog.csdnimg.cn/1975cc1cc8c44d55b919c8b3e5e4b20a.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>这里需拷贝一份zoo_sample.cfg样例配置文件，用于zk服务的配置</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">cp zoo_sample.cfg zoo.cfg<br></code></pre></td></tr></table></figure>
<p>该配置文件里的默认配置：</p>
<figure class="highlight abnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs abnf"><span class="hljs-attribute">tickTime</span><span class="hljs-operator">=</span><span class="hljs-number">2000</span><br><span class="hljs-attribute">dataDir</span><span class="hljs-operator">=/</span>var/lib/zookeeper<br><span class="hljs-attribute">clientPort</span><span class="hljs-operator">=</span><span class="hljs-number">2181</span><br></code></pre></td></tr></table></figure>
<p>以下是每个字段的含义：</p>
<table>
<thead>
<tr>
<th align="left">字段</th>
<th align="left">描述</th>
</tr>
</thead>
<tbody><tr>
<td align="left">tickTime</td>
<td align="left">ZooKeeper 使用的基本时间单位，以<strong>毫秒</strong>为单位。它用于做心跳，最小会话超时将是 tickTime 的两倍</td>
</tr>
<tr>
<td align="left">dataDir</td>
<td align="left">存储内存数据库快照的位置，除非另有说明，否则存储数据库更新的事务日志</td>
</tr>
<tr>
<td align="left">clientPort</td>
<td align="left">监听客户端连接的端口，默认为2181</td>
</tr>
</tbody></table>
<p>其中，可以将dataDir修改为当前zk的自定义的目录中，方便查询日志</p>
<h2 id="2-4-启动-zk"><a href="#2-4-启动-zk" class="headerlink" title="2.4 启动 zk"></a>2.4 启动 zk</h2><p>在zk根目录下，启动 zk：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">bin/zkServer.sh start<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/ea52d69f3e7949ed8add0bc213f8a41e.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="2-5-查看zk进程"><a href="#2-5-查看zk进程" class="headerlink" title="2.5 查看zk进程"></a>2.5 查看zk进程</h2><p><strong>查看启动情况：</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">jps<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/3618b106f40c4dabbb8eb10131f38c00.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>当出现 <code>QuorumPeerMain</code>的Java进程时，说明zk启动成功</p>
<h1 id="参-考-资-料"><a href="#参-考-资-料" class="headerlink" title="参  考  资  料"></a>参  考  资  料</h1><hr>
<p>[1] <a target="_blank" rel="noopener" href="https://baike.baidu.com/item/zookeeper/4836397?fr=aladdin">Zookeeper百度百科</a><br>[2] <a target="_blank" rel="noopener" href="https://zookeeper.apache.org/doc/current/zookeeperStarted.html">Zookeeper官方入门指南</a></p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E5%88%86%E5%B8%83%E5%BC%8F/" class="category-chain-item">分布式</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/Zookeeper/">#Zookeeper</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Zookeeper 笔记1 单节点配置</div>
      <div>http://example.com/2022/03/07/Zookeeper 笔记1  单节点配置/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>John Doe</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2022年3月7日</div>
        </div>
      
      
      <div class="license-meta-item">
        <div>许可协议</div>
        <div>
          
            
            
              <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
              <span class="hint--top hint--rounded" aria-label="BY - 署名">
                <i class="iconfont icon-by"></i>
              </span>
              </a>
            
          
        </div>
      </div>
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2022/03/19/Flume%20%E7%AC%94%E8%AE%B01%20%E4%BD%BF%E7%94%A8Flume%E6%94%B6%E9%9B%86netcat%E7%AB%AF%E5%8F%A3%E9%80%9A%E4%BF%A1%E7%9A%84%E4%BF%A1%E6%81%AF%E5%88%B0%E6%9C%AC%E5%9C%B0%E6%96%87%E4%BB%B6/" title="Flume 笔记1 使用Flume收集netcat端口通信的信息到本地文件">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Flume 笔记1 使用Flume收集netcat端口通信的信息到本地文件</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2022/03/01/%E6%9C%88%E5%BA%A6%E6%80%BB%E7%BB%93%20_%202022%E5%B9%B402%E6%9C%88%20_%20Web%E5%88%9D%E6%AC%A1%E4%BD%BF%E7%94%A8SpringBoot%E5%BC%80%E5%8F%91%E5%BF%83%E5%BE%97%20_%20%E5%81%87%E6%9C%9F%E4%B8%8E%E5%A4%A7%E4%B8%89%E4%B8%8B%E6%96%B0%E5%AD%A6%E6%9C%9F/" title="月度总结 _ 2022年02月 _ Web初次使用SpringBoot开发心得 _ 假期与大三下新学期">
                        <span class="hidden-mobile">月度总结 _ 2022年02月 _ Web初次使用SpringBoot开发心得 _ 假期与大三下新学期</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      collapseDepth   : CONFIG.toc.collapseDepth || 0,
      scrollSmooth    : true,
      headingsOffset  : -boardTop
    });
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.10/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
